package com.c.controller;

import com.c.pojo.entity.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class UserController {

    @Value("${userName}")
    private String userName;

//    @Value("${age}")
//    private Integer age;

    @RequestMapping(value = "getUserList", method = RequestMethod.GET)
    public Object getUserList() {
        Map<String, Object> map = new HashMap<>();
        map.put("code", 200);
        map.put("msg", "请求成功");
        List<User> userList = new ArrayList<>();
        userList.add(new User(1, "lili", 3, 2));
        map.put("userList", userList);
        return map;
    }

    @GetMapping("/getAdmin")
    public Object getUserInfo() {
        Map<String, Object> map = new HashMap<>();
        map.put("code", 200);
        map.put("msg", "用户信息");
        map.put("userName", userName);
//        map.put("password", age);
        return map;
    }
}
